<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/h-ui/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/h-ui/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/h-ui/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/h-ui/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>修改花型编号和尺寸</title>
</head>
<body>
<div class="pd-20">
	<form action="" method="post" class="form form-horizontal" id="update_PattrenNoAndCC_Form">
		<input type="hidden" id="pId" name="pId" value="${parent.pId }">		
       <div class="row cl">
           <label class="form-label col-3"><span class="c-red">*</span>编号：</label>
           <div class="formControls col-5">
           		<input type="text" class="input-text" value="${parent.pNo }" placeholder="请输入编号" id="pNo" name="pNo" datatype="*" nullmsg="编号不能为空">
           </div>
       </div>
       <div class="row cl">
           <label class="form-label col-3"><span class="c-red">*</span>尺寸：</label>
           <div class="formControls col-6">
               <input type="text" class="input-text" value="${parent.chicun }" style="width: 307px;" placeholder="请输入尺寸" id="chicun" name="chicun" datatype="*0-50" nullmsg="尺寸不能为空">
               <label style="display: inline;">&nbsp;cm</label>
           </div>
       </div>
       <div class="row cl">
       	 <div class="col-9 col-offset-3">
	         <a class="btn btn-primary save"  onclick="operationdata1('../Patterns/UpdateNoAndCC','#update_PattrenNoAndCC_Form')">保存</a>
	         <a class="btn btn-primary" onclick="closethis()">取消</a>
         </div>
       </div>
	</form>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/js/H-ui.admin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/webuploader/0.1.5/webuploader.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/uploadSingleImg.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/jqthumb/jqthumb.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/tableBtnGroup.js"></script>
<script type="text/javascript">
function closethis(){
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
   	parent.layer.close(index);
}


//保存表单数据
function operationdata1(dataurl,fromid){
	
	$.ajax({url:'${pageContext.request.contextPath }/admin/Patterns/chakan', data:{"pNo":$("#pNo").val(),"pId":$("#pId").val()},async : false,type : "POST",  success :function(result){
		 var status=result.msg.status;
		 var desc=result.msg.desc;
		 if(status==1){
			 layer.msg("编号已存在", {icon: 0,time: 1000},function(){
				 $("#pNo").focus();
				 return ;
			 }); 
			
		 }else{
			//判断必填文本框是否为空
				$(fromid).find('[datatype]').each(function(){
					if($(this).val().trim() == ""){
						var tishistr = $(this).addClass('Validform_error');
						$(this).parent().next().find('span').addClass('Validform_wrong').html('不能为空！');
					}
				});
				//判断文本框的内容是否填写正确
				var haserror = $(fromid).find('.Validform_error').length;
				if(haserror>0){
					alert('请填写正确数据！');
				}else{ 
					 $.post(dataurl,$(fromid).serialize(),function(result){
						 var status=result.msg.status;
						 var desc=result.msg.desc;
						    if(status == 0){
						    	layer.msg(desc, {icon: 1,time: 1000},
						    	 function(){
						    			//关闭子页面，刷新父页面
						    			var index = parent.layer.getFrameIndex(window.name);
								    	window.parent.location.reload();
								    	parent.layer.close(index);//关闭弹框 
						    	 }
						    	); 
						    
						    }else if(status == 1){
						    	layer.msg(desc, {icon: 0,time: 1000});
						    }
					  });
				}
		 }
}
});
	
}

</script>
</body>
</html>